({
    fetchData : function(cmp){
        var searchKeyWord = cmp.get("v.searchKeyWord");
        var currentPage = cmp.get("v.currentPage");
        var pageSize = cmp.get("v.pageSize");
        // 
        var action = cmp.get("c.getAccounts");
        // 设置请求参数
        action.setParams({
            searchKeyWord: searchKeyWord,
            currentPage: currentPage,
            pageSize: pageSize
        });
        // 处理回调函数
        action.setCallback(this, function(res) {
            // 返回状态
            var state = res.getState();
            if (state == "SUCCESS") {
                // 处理响应
                var resMap = res.getReturnValue();
                if (resMap.hasOwnProperty('record')) {
                    cmp.set("v.resData",resMap['record']);
                }
                if (resMap.hasOwnProperty('totalPage')) {
                    cmp.set("v.totalPage", resMap['totalPage']);
                }
            } else {
                // 处理错误
                var errors = res.getError();
                console.error(errors);
            }
        });
        // 队列处理
        $A.enqueueAction(action);
    }
})
